// namespaced: true,
const state = {
  userId: '0',
  token: '',
  userName: '游客'
}

const mutations = {
  updateUserInfo (state, info) {
    state.userId = info.id
    state.token = info.token
    console.log(info.token + info.id + info.name)
    state.userName = info.name
  },
  clearUserInfo (state) {
    state.userId = '0'
    state.token = ''
    state.userName = '游客'
  }
}

const getters = {
  getUserName (state) {
    return state.userName
  },
  getUserId (state) {
    return state.userId
  },
  getToken (state) {
    return state.token
  }
}
export default {
  namespaced: false,
  state,
  mutations,
  getters
}
